<#assign menu="user">
<#assign submenu="user_list">
<#include "/system/head.ftl">

<style type="text/css" xmlns="http://www.w3.org/1999/html">
    .pagination {
        border-radius: 4px;
        display: inline-block;
        margin: 0;
        padding-left: 0;
    }

    /* Portlet */
    .portlet > .portlet-body.green,
    .portlet.green {
        background-color: white;
    }

</style>
<!--main content start-->
<section id="main-content">
    <section class="wrapper">


        <section class="panel">

            <div class="tab-content">

                <div class="tab-pane active" id="tab_2">
                    <div class="portlet box green">
                        <div class="portlet-title">
                            <div class="caption">
                                <i class="fa fa-gift"></i>职位列表
                            </div>
                        </div>
                        <div class="portlet-body">
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <form method="post" action="${basePath}/admin/job/toSearch.htm">
                                            <div class="row">
                                                <div class="col-md-3">
                                                    <label class="control-label col-md-4"
                                                           style="font-size: 16px;"><nobr>职位类型 </nobr></label>

                                                    <div class="col-md-8">
                                                        <select name="jobType" id="jobType-select"
                                                                class="form-control">
                                                        <#list categoryList as e>
                                                            <option value=${e.id}>${e.name}</option>
                                                        </#list>
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="col-md-3">
                                                    <label class="control-label col-md-4"
                                                           style="font-size: 16px;"><nobr>职位名称 </nobr></label>

                                                    <div class="input-group col-md-8">
                                                        <input type="text" class="form-control" name="jobName"
                                                               value="${jobName}"
                                                               id="jobName" >
                                                    </div>
                                                </div>
                                                <div class="col-md-4">
                                                    <label class="control-label col-md-4" style="font-size: 16px;">
                                                        <nobr>工作地点</nobr></label>

                                                    <div class="input-group col-md-8">
                                                        <input type="text" class="form-control" name="jobAddress"
                                                               value="${jobAddress}"
                                                               id="jobAddress" >
                                                    </div>
                                                </div>

                                                <div class="input-group-btn col-md-2">
                                                    <button id="genpassword" class="btn btn-success" type="submit"
                                                            ><i class="fa fa-arrow-left fa-fw"></i>
                                                        查询
                                                    </button>
                                                </div>

                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </div>

                            <div class="panel-body">
                                <div class="adv-table">
                                    <div role="grid" class="dataTables_wrapper" id="hidden-table-info_wrapper">
                                        <table class="table table-striped table-advance table-hover">
                                            <thead>
                                            <tr>
                                                <th>职位编号</th>
                                                <th>职位类型</th>
                                                <th>职位名称</th>
                                                <th>商户名称</th>
                                                <th>工作时间</th>
                                                <th>工作地点</th>
                                                <th>佣金</th>
                                                <th>付款方式</th>
                                                <th>结薪方式</th>
                                                <th>开始时间</th>
                                                <th>结束时间</th>
                                                <th>招募人数</th>
                                                <th>候选人数</th>
                                                <th>发布时间</th>
                                                <th>更新时间</th>
                                                <th>审核状态</th>
                                                <th>图片地址</th>
                                                <th>职位描述</th>
                                                <th>操作</th>
                                            </tr>
                                            </thead>
                                            <tbody role="alert" aria-live="polite" aria-relevant="all">
                                            <#list pageVo.list as e>
                                            <tr class="gradeA odd">
                                                <td>${e.id}</td>
                                                <td>
                                                    <#if "${e.jobType}" = "1">
                                                        模特
                                                    <#elseif "${e.jobType}" = "2">
                                                        家教
                                                    <#elseif "${e.jobType}" = "3">
                                                        服务员
                                                    </#if>
                                                </td>
                                                <td>${e.name}</td>
                                                <td>${e.merchantName}</td>
                                                <td>${e.jobTime}</td>
                                                <td>${e.jobAddress}</td>
                                                <td>${e.amount}</td>
                                                <td>
                                                    <#if "${e.salaryType}" = "cash">
                                                        现金
                                                    <#elseif "${e.salaryType}" = "payTreasure">
                                                        支付宝
                                                    </#if>

                                                </td>
                                                <td>
                                                    <#if "${e.payCycle}" = "hour">
                                                        时
                                                    <#elseif "${e.payCycle}" = "day">
                                                        天
                                                    <#elseif "${e.payCycle}" = "week">
                                                        周
                                                    <#elseif "${e.payCycle}" = "month">
                                                        月
                                                    </#if>
                                                </td>
                                                <td>${e.startTime?string("yyyy-MM-dd")}</td>
                                                <td>${e.endTime?string("yyyy-MM-dd")}</td>
                                                <td>${e.recruitNum}</td>
                                                <td>${e.candidateNum}</td>
                                                <td>${e.updateTime?string("yyyy-MM-dd")}</td>
                                                <td>${e.createTime?string("yyyy-MM-dd")}</td>
                                                <td>
                                                    <#if "${e.status}" = "audit">
                                                        已审核
                                                    <#elseif "${e.status}" = "noAudit">
                                                        未审核
                                                    </#if>
                                                </td>
                                                <td>${e.imageUrl}</td>
                                                <#if "${e.description}"?length gt  20>
                                                    <td>${e.description?substring(0,20)}...</td>
                                                <#else>
                                                    <td>${e.description}</td>
                                                </#if>

                                                <td>
                                                    <a href="${basePath}/admin/job/detail.htm?jobId=${e.id}" title="修改">
                                                        编辑
                                                    </a>
                                                    <a class="js_delete_job" href="javascript:void(0);" uid="${e.id}"
                                                       title="删除">
                                                        删除
                                                    </a></td>
                                            </tr>
                                            </#list>
                                            </tbody>
                                        </table>
                                        <div style="height: 30px;">
                                            <div class="pagination">${pageVo.pageNumHtml} </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>


        </section>
    </section>
</section>


<script>
    $(function () {
        $(".js_userId").hide();
    });

    $('.js_delete_job').click(function () {
        var uid = $(this).attr('uid');
        bootbox.dialog({
            message: "是否" + $(this).attr('title'),
            title: "提示",
            buttons: {
                "delete": {
                    label: "确定",
                    className: "btn-success",
                    callback: function () {
                        $.get("${basePath}/admin/job/delete.json", {"jobId": uid}, function (data) {
                            console.log(data);
                            $("#jobId_" + uid).remove();
                            window.location.reload();
                        });
                    }
                },
                "cancel": {
                    label: "取消",
                    className: "btn-primary",
                    callback: function () {
                    }
                }
            }
        });
    });
</script>
<script src="${basePath}/system/js/jquery.cityselect.js"></script>
<script>
    $("#city_2").citySelect({prov: "江苏", nodata: "none"});
</script>
<#include "/system/foot.ftl">

<#--选择器初始化-->
<script>
$("#jobType-select").val("");
    initFileUpload();
</script>
